package com.heima.comment.controller.v1;


import com.heima.comment.service.CommentService;
import com.heima.model.comment.dtos.CommentDto;
import com.heima.model.comment.dtos.CommentLikeDto;
import com.heima.model.comment.dtos.CommentSaveDto;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment")
@Slf4j
@Api(value = "app端用户评论相关接口" ,tags = "app端用户评论相关接口")
public class CommentController {


    @Autowired
    private CommentService commentService;

    @PostMapping("/save")
    @ApiOperation("用户评论")
    public ResponseResult save(@RequestBody CommentSaveDto dto){
        return commentService.save(dto);
    }

    @PostMapping("/load")
    @ApiOperation("加载评论列表")

    public ResponseResult load(@RequestBody CommentDto dto){
        return commentService.load(dto);
    }

    @PostMapping("/like")
    @ApiOperation("用户点赞评论")
    public ResponseResult like(@RequestBody CommentLikeDto dto){
        return commentService.like(dto);
    }

}
